<template>
	<!-- 		统计汇总页 -->
	<view class="u-demo back" style="height: 100%;" v-if="object.contractTongjilistData.length">
		<view v-if="user_type==='自然人' || user_type==='法人'" style="">
			<uni-transition :duration="1000" :mode-class="'slide-bottom'"  :show="true" >
				<view  style="border-bottom: none;margin-left: 20rpx;font-size: 26rpx;font-weight: bold;display: flex;justify-content: space-between;padding-right: 20rpx;margin-bottom:30rpx">
					<text>历史记账</text>
					<text>{{historyjizhang}} 次</text>
				</view>
			</uni-transition>
			<uni-transition :duration="1500" :mode-class="'slide-bottom'"  :show="true" >
				<view  style="border-bottom: none;margin-left: 20rpx;font-size: 26rpx;font-weight: bold;display: flex;justify-content: space-between;padding-right: 20rpx;">
					<text>历史调研</text>
					<text>{{historydiaoyan}} 次</text>
				</view>
			</uni-transition>
		</view>
		<view v-if="user_type==='联络人'">
			<view class="back"    >
				    <uni-transition :duration="1500" :mode-class="'slide-bottom'"  :show="true" >
						<view  style="border-bottom: none;margin-left: 20rpx;font-size: 27rpx;font-weight: bold;">
							合同统计
						</view>
						<view class="container">
							<text class="title">样本</text>
							<text class="title">总数量</text>
							<text class="title">已签订</text>  
							<text class="title">已拒绝</text>  
							<text class="title">待审批</text>
							<text class="title">未提交</text>
							<text class="title">操作</text>
						</view>
						<view class="container" v-for="(item, index) in object.contractTongjilistData" :key="index">
							<text class="title" style="font-weight: normal">{{ item.key || 0 }}</text>
							<text class="title" style="font-weight: normal">{{ item.num  || 0}}</text>
							<text class="title" style="font-weight: normal">{{ item.num3  || 0}}</text>
							<text class="title" style="font-weight: normal">{{ item.num2  || 0}}</text>
							<text class="title" style="font-weight: normal">{{ item.num1  || 0}}</text>
							<text class="title" style="font-weight: normal">{{ item.num0  || 0}}</text>
							<text class="title"  style="color: #1D69FC;" @click="urlPopup(item,index,'合同')">催报</text>
						</view>
					</uni-transition>
				</view>
				<view class="back" style="padding-top: 50rpx;margin: 0 10rpx;"  >
					  <uni-transition :duration="1700" :mode-class="'slide-bottom'"  :show="true" >
					<view  style="border-bottom: none;margin-left: 20rpx;font-size: 27rpx;font-weight: bold;text-align: left;margin-bottom: 10rpx;">
						记账统计
					</view>
				    <view class="" style="display: flex;justify-content: space-between; border-bottom: 1px solid #e5e5e5;padding-top: 10rpx;
			padding-bottom: 24rpx;">
				    	<text style="width: 30%;font-size: 25rpx;font-weight: bold;display: inline-block;text-align: center;" class="" v-for="(item,index) in object.jizhangTab" :key="index">{{item}}</text>
				    </view>
					<view style="border-bottom: 1px solid #e5e5e5;" class="" v-for="(item, index) in object.jizhangListData" :key="index">
						<text class="" style="padding-bottom: 5rpx;  line-height: 53rpx; padding: 13rpx;text-align: center; font-size: 25rpx;font-weight: normal;width:20%;display:inline-block;">{{ item.key || 0 }}</text>
						<text class="" style="padding-bottom: 5rpx;  line-height: 53rpx;padding: 13rpx;text-align: center;font-size: 25rpx;font-weight: normal;width:20%;display:inline-block;">{{ item.num  || 0}}</text>
						<text class="" style="padding-bottom: 5rpx;  line-height: 53rpx; padding: 13rpx;text-align: center;font-size: 25rpx;font-weight: normal;width:20%;display:inline-block;">{{ item.num1  || 0}}</text>
						<text class="" style="padding-bottom: 5rpx;  line-height: 53rpx;padding: 13rpx;text-align: center;font-size: 25rpx;font-weight: normal;width:20%;display:inline-block;">{{ item.num0  || 0}}</text>
						<text class=""  style="padding-bottom: 5rpx;  line-height: 53rpx; padding: 13rpx;text-align: center;color: #1D69FC;font-size: 25rpx;width:20%;display:inline-block;font-weight: bold;" @click="urlPopup(item,index,'记账')">催报</text>
					</view>
					</uni-transition>
				
					<u-popup v-model="isShowPopup" mode="center" height=""  closeable  length="85%"  border-radius="20">
						<view style="padding: 20rpx;height: 100%;padding-top: 20rpx;padding-left: 20rpx;padding-right: 20rpx;">
							<view class="text-center fontWeight textColor text30" style="margin-bottom: 20rpx;">
								未提交名单
							</view>
							<!--justify-content: space-between;flex: 5;align-items: center; -->
							<view class="flex " >
								<text v-if="detailListData[0].key==='自然人'" style="flex:2;font-weight: bold;">姓名</text>
								<text v-if="detailListData[0].key==='法人'" style="flex:2;font-weight: bold;">单位</text>
								<view class="" style=" display: flex;flex:8">
									<view class="" style="flex: 1;text-align: center;"  >
										<text style="font-weight: bold;">小程序推送</text>
									</view>
									<view class="" style="flex: 1;text-align: center;" >
										<text style="font-weight: bold;">电话</text>
									</view>
									<view class="" style="flex: 1;text-align: center;"  >
										<text style="font-weight: bold;">短信</text>
									</view>
								</view>
							</view>
							<!-- -->
							<view  class="flex Jbetween " style="margin-bottom: 10rpx;border-bottom: 1px solid #f5f5f5;padding-bottom: 15rpx;flex-direction: column;">
								<view  style="display:flex;display: flex;align-items: center;margin: 30rpx 0;" v-if="detailListData.length"  v-for="(item,index) in detailListData" :key="index">
									<text v-if="item.key==='法人'" style="flex:2;" class="">
										 {{item.unit_name || item.name}}:
									</text > 
									<text v-if="item.key==='自然人'"  style="flex:2;" class="">
										 {{item.name}}:
									</text > 
									<view style=" display: flex;flex:8" class="name-content overflow ">
										<!-- {{item.name?item.name:item.unit_name}} -->
										<view class=""  style="flex: 1;text-align: center;" @click="makeChange(item,1)">
											 <image style="width: 50rpx ;height: 50rpx;" src="../static/xiaochengxu.png" mode="" ></image> 
										</view>
										<view class=""  style="flex: 1;text-align: center;"  @click="makeChange(item,2)">
											<image  style="width: 50rpx ;height: 50rpx;" src="../static/dianhua.png" mode="" ></image>
										</view>
										<view class=""  style="flex: 1;text-align: center;"  @click="makeChange(item,3)">
											 <image  style="width: 50rpx ;height: 50rpx;" src="../static/duanxin.png" mode="" ></image>
										</view>
									</view>
								</view>
							</view>
							<view v-if="!detailListData.length"  class=" fontWeight text-center" style="color: #999999;">暂无未提交名单</view>
						</view>
					</u-popup>
				</view>
				
				<view class="back" style="padding-top: 50rpx;margin: 0 10rpx;"  >
					<uni-transition :duration="1900" :mode-class="'slide-bottom'"  :show="true" >
						<view  style="border-bottom: none;margin-left: 20rpx;font-size: 27rpx;font-weight: bold;text-align: left;margin-bottom: 10rpx;">
							问卷统计
						</view> 
						<view class="" @click='openPicker' style="display: flex;justify-content: space-between;border:1px solid #cecece;align-items: center;width: 80%;padding: 18rpx 10rpx 18rpx 20rpx;margin: 20rpx 0 30rpx 20rpx;">
							<text>{{checkedPickerVal?checkedPickerVal:"请选择问卷"}}</text>
							<u-icon :name="iconName" color="#bebebe"></u-icon>
						</view>
					</uni-transition>
						<!-- <custom-picker
							ref="cPicker"
							title="请选择问卷"
							titleColor="#808080"
							titleFontSize="26rpx"
							cancelType='icon'
							cancelColor="#999999"
							cancleFontSize="28rpx"
							confirmColor="#1D69FC"
							confirmFontSize="34rpx"
							confirmFontWeight="500"
							itemFontSize="28rpx"
							@onClose="closePicker"
							@onConfirm="confirmPicker"
							@showPickerChange="showPickerChange"
							:pickerList="object.wenjuanListData">
						</custom-picker> -->
					<view class="">
						<u-picker v-model="isShowPicker" mode="selector" :range="object.wenjuanListData" range-key="label" @confirm="confirmPicker"></u-picker>
					</view>
					<uni-transition :duration="1900" :mode-class="'slide-bottom'"  :show="true" >
						<view class="container">
							<text class="title">样本</text>
							<text class="title">应提交</text>
							<text class="title">已提交</text>  
							<text class="title">未提交</text>  
							<text class="title">操作</text>
						</view>
						<view class="container" v-for="(item, index) in object.wenjuanTongjilistData" :key="index">
							<text class="title" style="font-weight: normal">{{ item.key || 0 }}</text>
							<text class="title" style="font-weight: normal">{{ item.num  || 0}}</text>
							<text class="title" style="font-weight: normal">{{ item.num3  || 0}}</text>
							<text class="title" style="font-weight: normal">{{ item.num2  || 0}}</text>
							<text class="title"  style="color: #1D69FC;" @click="urlPopup(item,index,'问卷')">催报</text>
						</view>
					</uni-transition>
					<!-- <uni-load-more v-if="" :status="uniStatus" :content-text="uniContentText" iconType="circle" /> -->
				</view>
		</view>
		<view v-if="user_type==='自然人'">
			<view class="back"    style="margin-top: 30rpx;">
				<uni-transition :duration="1500" :mode-class="'slide-bottom'"  :show="true" >
					<view  style="border-bottom: none;margin-left: 20rpx;font-size: 27rpx;font-weight: bold;color:#0D7BD7;">
						年度报表
					</view>
					<view class="" style="margin-top: 20rpx;">
						<view v-for="(item,index) in reportListData" :key="index" style="display: flex;justify-content: space-between;padding: 20rpx 20rpx; border-top:1px solid #e3e3e3;border-bottom: 1px solid #e3e3e3;align-items: center;">
							<text style="flex: 1;font-size: 27rpx;">{{item.year+'年度报表'}}</text>
							<button class="mini-btn"  size="mini" style="background-color: #1D69FC;color:#fff;font-size: 25rpx;" @click="reportChange(item.id)">报表详情</button>
						</view>
					</view>
				</uni-transition>
			</view>
		</view>
		
		<view  style="text-align: center;padding-top:50rpx;color: #999999;font-size: 24rpx;">
			<u-loadmore
			  :status="status" 
			  :loading-text="loadingText" 
			  :loadmore-text="loadmoreText" 
			  :nomore-text="nomoreText" 
			    />
		</view>
		<!-- 问卷统计列表 -->
		<!-- <u-popup  v-model="uPickerShow" @close="close" @open="open"  mode="bottom"  closeable round="20">
			<view class="" style="height: 400rpx;display: flex;flex-direction: column;justify-content: center;text-align: center;">
				<scroll-view scroll-y="true" class="scroll-Y"  style="border: 1px solid red;height:50rpx;" :show-scrollbar="false">
					<view v-for="(item,index) in object.wenjuanListData">{{item}}</view>
				</scroll-view>
			</view>
		</u-popup> -->
	</view>
</template>

<script>
	import customPicker  from "../components/picker/picker.vue"
	import util from '@/utils/util.js'
	export default {
		components:{
			customPicker
		},
		data() {
			return {
				reportListData:[],//年报列表
                msgType:"",//小程序推送的类型 1  合同推送  2  记账推送   3.问卷推送
				is:false,
				wenjuanShow:false,
				uniStatus: 'loading',
				uniContentText: {
					contentdown: '',
					contentrefresh: '加载中',
					contentnomore: ''
				},
				isClose:false,
				isShowPicker:false,//是否显示底部问卷题目弹窗
			    checkedPickerVal:"",//选择的问卷类型
				iconName:"arrow-down",//是否展开了问卷列表
				status: 'nomore',
				loadingText: '努力加载中',
				loadmoreText: '轻轻上拉',
				nomoreText: '实在没有了',
				borderColor: '#e4e7ed',
				align: 'center',
				isShowPopup:false,//默认详情弹窗
				value: null,//问卷类型下标
				localdata: [
				  { value: 0, text: "游云南平台用户体验貂蝉问卷" },
				  { value: 2, text: "游21321321" },
				],
				object:{
					contentTab:["样本","总数量","已签订","已拒绝","待审批","未提交","操作"],//导航类别
					jizhangTab:["样本","总数量","本月已记账","本月未记账","操作"],
					contractTongjilistData: [],//合同统计数据
					wenjuanTongjilistData: [],//问卷统计汇总列表数据
					jizhangListData:[],// 记账统计列表数据
					wenjuanListData:[{
						value:"1",
						label:"云南旅游调查问卷"
					},{
						value:"2",
						label:"旅游调查问卷"
					},{
						value:"2",
						label:"游云南平台用户体验貂蝉问卷"
					},{
						value:"4",
						label:"游21321321"
					}],//问卷统计列表数据
					liaison:null  //联络人姓名
					
				},
				//是否显示合同统计  只有联络员才会显示合同统计于调研记账统计  自然人于法人显示调研记账统计。并且为暂无数据
				// 统计汇总数据
				
			
				// 存储用户信息数据
				userInfo:null,
				//未提交详情数据
				detailListData:[],
				historyjizhang:0,
				historydiaoyan:0,
				id:"",
				user_type:"",
				type_id:'',
				wenjuan_listData:[],//调研列表数据
				name:"",//联络人名称
				content:"",
				openid:""//用户授权后唯一标识
				
				
			}
		},
		/*下拉刷新*/
		onPullDownRefresh: function() {
			this.iconName="arrow-down"//问卷统计选择问卷箭头默认向下
			let openID=uni.getStorageSync('openid')
			this.openid=openID
			 let userInfo = uni.getStorageSync('userInfo');
			 if (userInfo) {
			 	this.userInfo = userInfo
			 	this.id = userInfo[0].id,
			 	this.user_type = userInfo.user_type
			 } 
			 if(userInfo.user_type=="法人"){
			 	this.type_id=userInfo[0].business_specific_type
			 }
			 if(userInfo.user_type=="联络人"){
				 this.object.liaison=userInfo[0].name//联络人姓名
			 }
			 
			 console.log('虎丘缓存',this.user_type)
			// 获取联络人统计数据   此统计数据只有联络人才会显示。法人和自然人不会显示该数据  合同统计
			this.getContractTongji();
			// 获取记账统计数据
			this.getJizhangTongjiListData()
			// 获取历史记账数据
			this.getHistoryBillListData()
			// 获取历史调研列表数据
			this.getWenjuan_listData()
			// 获取问卷统计下拉列表数据
			this.getSelectData()
		    // 获取年报列表
			this.getReportListData()
			setTimeout(() => {
				//关闭下拉刷新
				uni.stopPullDownRefresh()
			}, 1000)
		},
		computed: {
			current() {
				return this.loading ? 0 : 1;
			},
		},
		onLoad() {
			this.iconName="arrow-down"//问卷统计选择问卷箭头默认向下
			let openID=uni.getStorageSync('openid')
			this.openid=openID
			 let userInfo = uni.getStorageSync('userInfo');
			 if (userInfo) {
			 	this.userInfo = userInfo
			 	this.id = userInfo[0].id,
			 	this.user_type = userInfo.user_type
			 }
			 if(userInfo.user_type=="法人"){
			 	this.type_id=userInfo[0].business_specific_type
			 }
			 if(userInfo.user_type=="联络人"){
				 this.object.liaison=userInfo[0].name//联络人姓名
			 }
			 
			 console.log('虎丘缓存',this.user_type)
			// 获取联络人统计数据   此统计数据只有联络人才会显示。法人和自然人不会显示该数据  合同统计
			this.getContractTongji();
			// 获取记账统计数据
			this.getJizhangTongjiListData()
			// 获取历史记账数据
			this.getHistoryBillListData()
			// 获取历史调研列表数据
			this.getWenjuan_listData()
			// 获取问卷统计下拉列表数据
			this.getSelectData()
			// 获取年报列表
			this.getReportListData()
			
			
		},
		methods: {
			// 报表详情点击事件
			reportChange:function(id){
				console.log('详情id',id)
				uni.navigateTo({
					url:"../year/index?detailId="+id
				})
			},
			// 获取年报列表
			getReportListData:function(){
				this.status='loading'
				var that=this
				uni.request({
					method: 'POST',
					url: 'https://jizhang.xqyu.cn/index.php/addons/ykquest/survey_api/report_user',
					dataType: 'json',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						user_id:that.id
					},
					success: function (res) {
						console.log('获取统计汇总年报列表内容获取统计汇总年报列表内容获取统计汇总年报列表内容获取统计汇总年报列表内that.reportListData容',res)
						if(res.data.code==1){
							that.status='nomore'
							that.reportListData=res.data.data
						}else{
							that.status='nomore'
							that.reportListData=[]
						}
						
					}
				});
			},
			//打开问卷列表弹窗
			openPicker(){
				this.iconName="arrow-right"
				// this.$refs.cPicker._open()  对应上面custom-piker区域
				this.isShowPicker=true
				
			},
			// 问卷列表确定
			confirmPicker:function(e){
				var that=this
				this.status="loading"
				this.checkedPickerVal=""
				this.object.wenjuanTongjilistData=[]
				this.checkedPickerVal=this.object.wenjuanListData[e[0]].label
				this.iconName="arrow-down"
				setTimeout(function(){
					that.getLiaison_wenjuanData()
				},250)
				
				// contractTongjilistData
				// 此处调用问卷列表接口
				
			},
			showPickerChange:function(e){
				console.log('e',e)
				// this.$refs.cPicker._close()
			},
			// 问卷列表取消
			closePicker:function(e){
				console.log('this.name',this.name)
				// this.$refs.cPicker._close()
			},
			// 获取问卷统计下拉列表数据
			getSelectData:function(){
				this.object.wenjuanListData=[]
				var that=this
				uni.request({
					method: 'POST',
					url: 'https://jizhang.xqyu.cn/index.php/api/index/title_list',
					dataType: 'json',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
					},
					success: function (res) {
						console.log('获取问卷统计下拉列表数据',res)
						if(res.data.code==1){
							let arr=[]
							res.data.data.forEach((item,index)=>{
								let obj={
									value:index+1,
									label:item.name
								}
								arr.push(obj)
							})
							console.log('获取赋值的问卷下拉',arr)
							that.object.wenjuanListData=arr
						}else{
							that.$.toast(res.data.msg)
						}
					}
				});
			},
			// 获取问卷统计汇总数据
			getLiaison_wenjuanData:function(){
				var _self=this
				uni.request({
					method: 'POST',
					url: 'https://jizhang.xqyu.cn/index.php/api/index/liaison_wenjuan',
					dataType: 'json',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
					   title:_self.checkedPickerVal,
					   name: _self.object.liaison
					},
					success: function (res) {
						console.log('获取问卷统计汇总数据',res)
						if(res.data.code==1){
							if(res.data.data.length==1){
								console.log('走的第一个')
								_self.$set(res.data.data[0], "key","自然人")
								let obj={
									id: null,
									key: "法人",
									liaison: res.data.data[0].liaison,
									num: 0,
									num0: 0,
									num1: 0,
									phone: "",
									title: "",
									unit_name: ""
								}
								res.data.data.push(obj)
							}else{
								console.log('走的第二个')
								_self.$set(res.data.data[0], "key","自然人")
								_self.$set(res.data.data[1], "key","法人")
							}
							
							console.log('获取自然人法人数据',res.data.data)
							_self.object.wenjuanTongjilistData=res.data.data
							_self.status="nomore"
						}
					}
				});
			},
			// 
			getWenjuan_listData:function(){
				var that=this
				uni.showToast({
					title: '加载中...',
					icon: 'loading',
					duration: 1000
				});
				this.status='loading'
				uni.request({
					method: 'POST',
					url: 'https://jizhang.xqyu.cn/index.php/api/index/wenjuan_list',
					dataType: 'json',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
					   openid:that.openid
					},
					success: function (res) {
						console.log('')
						// 数据加载完成，隐藏弹窗
						uni.hideLoading();
						if(res.data.code==1){
							that.status='nomore'
							that.historydiaoyan=res.data.data.length
							
						}else{
							that.status='nomore'
							that.historydiaoyan=0
						}
					}
				});
			},
			// 获取记账列表数据
			getHistoryBillListData: function () {
			   var that = this;
				console.log('传递',this.id,this.user_type,)
				uni.showToast({
					title: '加载中...',
					icon: 'loading',
					duration: 1000
				});
			    that.status="loading"
				uni.request({
					method: 'POST',
					url: 'https://jizhang.xqyu.cn/index.php/api/index/get_bill',
					dataType: 'json',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						uid: that.id,
						user_type: that.user_type,
						type_id:that.type_id
					},
					success: function (res) {
						that.status='nomore'
						// 数据加载完成，隐藏弹窗
						uni.hideLoading();
						if (res.data.code == 1) {
							console.log('获取历史账单',res.data.data.length)
							that.historyjizhang=res.data.data.length
						}else{
							that.status='nomore'
						}
					}
				});
			},
			urlPopup:function(item,index,content){
				console.log('点击的行',item,index,content)
				this.content=content
            this.msgType=content
				if(content==="合同"){
					console.log('走合同提交')
					this.detailListData=[]
					this.getContractDetails(item.key)
				}else if(content==="记账"){
					console.log('走记账提交',item)
					this.detailListData=[]
					let type=""
					if(item.key==="自然人"){
						type=1
					}else if(item.key==='法人'){
						type=2
					}
					this.getJizhangDetails(type)
				}else{
					this.detailListData=[]
					console.log('走问卷提交走问卷提交走问卷提交',item) 
					this.getWenjuanDetails(item)
					
					
				}
				this.isShowPopup=true//弹窗
			},
			// 获取问卷催报详情数据
			getWenjuanDetails:function(data){
				console.log('传递的问卷详情',data)
				var that=this
				uni.request({
				    method: 'POST',
				    url: 'https://jizhang.xqyu.cn/index.php/api/index/wenjuan_wei_list',
				    dataType: 'json',
				    header: {
				        'content-type': 'application/x-www-form-urlencoded'
				    },
				    data: {
				        type: data.key,
						title:that.checkedPickerVal,
						name: that.object.liaison
				    },
				    success: function (res) {
						that.$.hideLoading()// 数据加载完成，隐藏弹窗
				        if (res.data.code == 1) {
							if(data.key=='自然人'){//以此判断自然人于法人显示姓名于单位
								res.data.data.forEach(item=>{
									item.key='自然人'
								})
							}else {
								res.data.data.forEach(item=>{
									item.key='法人'
								})
							}
							that.detailListData=res.data.data    
				        }
						  console.log('获取统计问卷详情结果',res.data)
				    }
				})
				
				
			},
         // 小程序推送
         getwechatMsg:function(item,type){
            console.log('发送消',item,type, this.msgType)
            var that=this
            var type=""
            if(this.msgType==="合同"){
               type=1
            }else if(this.msgType==="记账"){
               type=2
            }else {
               type=3
            }
            var data={
               type:type,//推送类型
               user_type:item.key==="自然人"?1:2,//接受消息者身份
               child:item.name?item.name:item.unit_name,//接受消息者
               name:this.object.liaison//联络人姓名
            }
            console.log('参数',data)
            this.$.tipLoading('小程序推送中...')
            uni.request({
                method: 'POST',
                url: 'https://jizhang.xqyu.cn/index.php/api/index/wechat_msg',
                dataType: 'json',
                header: {
                    'content-type': 'application/x-www-form-urlencoded'
                },
                data:data,
                success: function (res) {
                 if (res.data.code == 1) {
                    that.$.hideLoading()// 数据加载完成，隐藏弹窗
                    console.log('获取是否推送成功',res.data)
                    that.$.successToast('已推送')
                    that.isShowPopup=false//关闭弹窗
                  }else{
                     that.$.toast(res.data.msg)
                  }
                }
            })
         },
			// 短信。信息。电话点击事件
			makeChange:function(item,type){
				console.log('推送',item,type)
				if(type==1){
					var that=this
					uni.showModal({
						title: '温馨提示',
						content: '确认推送小程序吗',
					success: function (res) {
						if (res.confirm) {
							// 小程序推送
							that.getwechatMsg(item,type)
						}else if (res.cancel) {
							   console.log('用户点击取消');
						    }
						},
					})
				}else if(type==2){
					uni.makePhoneCall({
						 phoneNumber:item.phone
					});
				}else{
					console.log('this.content',this.content)
					if(this.content==="记账"){
						if(item.key==="自然人"){
							var event="natural"
						}else{
							var event="legal"
						}
					}else if(this.content==="问卷"){
						var event="wenjuan"
					}
					this.makeSms(item,event)
				}
			},
			// 短信
			makeSms:function(item,event){
				console.log('获取短信传递的参数获取短信传递的参数获取短信传递的参数获取短信传递的参数',item,event)
				var that = this
				uni.showModal({
					title: '温馨提示',
					content: '确认发送短信吗',
					success: function (res) {
						if (res.confirm) {
							that.$.tipLoading('短信发送中')
							uni.request({
							    method: 'POST',
							    url: 'https://jizhang.xqyu.cn/index.php/api/sms/send',
							    dataType: 'json',
							    header: {
							        'content-type': 'application/x-www-form-urlencoded'
							    },
							    data: {
							        mobile:item.phone,
									event:event || "" 
							    },
							    success: function (res) {
							        if (res.data.code == 1) {
										that.$.hideLoading()// 数据加载完成，隐藏弹窗
										 that.$.successToast(res.data.msg)
										setTimeout(function(){
											 that.isShowPopup=false//关闭详情弹窗
										 },1000)
							        }else {
										that.$.toast(res.data.msg)
										setTimeout(function(){
											 that.isShowPopup=false//关闭详情弹窗
										 },1000)
										  // setTimeout(function(){
											 //  let obj={
											 //  	isShowPopup:false,//是否显示弹窗
											 //  }
											 //  that.dataPopup=obj
										  // },1000)
									  }
							    }
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			close:function(e){
				this.isShowPopup=e
			},
			// 短信
			// makeSms:function(item){
			// 	var that = this
			// 	uni.request({
			// 	    method: 'POST',
			// 	    url: 'https://jizhang.xqyu.cn/index.php/api/sms/send',
			// 	    dataType: 'json',
			// 	    header: {
			// 	        'content-type': 'application/x-www-form-urlencoded'
			// 	    },
			// 	    data: {
			// 	        mobile: item.phone,
			// 			  event:'yanzhangma'
			// 	    },
			// 	    success: function (res) {
			// 			that.$.hideLoading()// 数据加载完成，隐藏弹窗
			// 	        if (res.data.code == 1) {
			// 				 that.$.successToast(res.data.msg)
			// 				 // setTimeout(function(){
			// 					//  that.isShowPopup=false//关闭详情弹窗
			// 				 // },1000)
			// 	        }else {
			// 				  // that.$.toast(res.data.msg)
			// 				  // setTimeout(function(){
			// 				  // 		that.isShowPopup=false//关闭详情弹窗
			// 				  // },1000)
			// 			  }
			// 	    }
			// 	});
			// },
			
			//// 获取联络人统计数据   此统计数据只有联络人才会显示。法人和自然人不会显示该数据
			getContractTongji:function(){
				var that=this
				this.$.tipLoading("加载中")
				uni.request({
				    method: 'POST',
				    url: 'https://jizhang.xqyu.cn/index.php/api/index/get_contract_tongji',
				    dataType: 'json',
				    header: {
				        'content-type': 'application/x-www-form-urlencoded'
				    },
				    data: {
				        name: that.userInfo[0].name
				    },
				    success: function (res) {
						that.$.hideLoading()// 数据加载完成，隐藏弹窗
				        if (res.data.code == 1) {
							console.log('获取合同统计数据',res.data.data.legal,res.data.data.natural)
							let legal=res.data.data.legal
							let natural=res.data.data.natural
							// 数组里插入对应类型名称
							legal.forEach(item=>{
								item.key='法人'
							})
							natural.forEach(item=>{
								item.key='自然人'
							})
							let contractTongjilistData=legal.concat(natural)
							that.object.contractTongjilistData=contractTongjilistData
							console.log('渲染',that.object.contractTongjilistData)
				        }
				    }
				});
			},
			// 获取记账统计数据/
			getJizhangTongjiListData:function(){
				var that=this
				uni.request({
				    method: 'POST',
				    url: 'https://jizhang.xqyu.cn/index.php/api/index/jizhang_list',
				    dataType: 'json',
				    header: {
				        'content-type': 'application/x-www-form-urlencoded'
				    },
				    data: {
				        name: that.userInfo[0].name
				    },
				    success: function (res) {
						console.log('获取记账统计数据',res)
				        if (res.data.code == 1) {
							console.log('获取记账统计数据',res)
							let legal=res.data.data[1]//法人
							let natural=res.data.data[0]//自然人
							that.$set(legal, 'key','法人')
							that.$set(natural, 'key','自然人')
							let jizhangListData=[legal,natural]
							jizhangListData.push()
							that.object.jizhangListData=jizhangListData
							console.log('传递',that.object.jizhangListData)
				        }
				    }
				});
			},
			// 记账为提交人员向
			getJizhangDetails:function(params){
				console.log('提交之前',params)
				var that=this
				this.$.tipLoading("加载中")
				uni.request({
					method: 'POST',
					url: 'https://jizhang.xqyu.cn/index.php/api/index/wei_list',
					dataType: 'json',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						type: params,
						name:that.userInfo[0].name
					},
					success: function (res) {
						that.$.hideLoading()// 数据加载完成，隐藏弹窗
						if (res.data.code == 1) {
							if(params==2){//以此判断自然人于法人显示姓名于单位
								res.data.data.forEach(item=>{
									item.key='法人'
								})
							}else {
								res.data.data.forEach(item=>{
									item.key='自然人'
								})
							}
							that.detailListData=res.data.data 
							console.log('成功获取记账列表详情数据成功获取记账列表详情数据成功获取记账列表详情数据that.detailListDatathat.detailListDatathat.detailListData',that.detailListData)
						}else{
							that.detailListData=[]
							 console.log('失败获取记账列表详情数据a',that.detailListData)
						}
						 
					}
				})
			},
			
			// //合同 未提交人员详情
			getContractDetails:function(key){
				console.log('获取合同统计传递的数据',key)
				var that=this
				this.$.tipLoading("加载中")
				uni.request({
				    method: 'POST',
				    url: 'https://jizhang.xqyu.cn/index.php/api/index/get_contract_details',
				    dataType: 'json',
				    header: {
				        'content-type': 'application/x-www-form-urlencoded'
				    },
				    data: {
				        user_type: key,
						liaison:that.userInfo[0].name
				    },
				    success: function (res) {
						
						that.$.hideLoading()// 数据加载完成，隐藏弹窗
				        if (res.data.code == 1) {
							if(key=='自然人'){//以此判断自然人于法人显示姓名于单位
								res.data.data.forEach(item=>{
									item.key='自然人'
								})
							}else {
								res.data.data.forEach(item=>{
									item.key='法人'
								})
							}
							that.detailListData=res.data.data    
				        }
						  console.log('获取统计1231232详情数据获取统计1231232详情数据获取统计1231232详情数据获取统计1231232详情数据',that.detailListData)
				    }
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #FFFFFF !important;
	}
	.uni-picker-action.uni-picker-action-confirm{
		color:red !important;
	}
	.container {
	    display: flex;
	    padding: 0 10rpx;
		 justify-content: space-around;
	}
	.title {
	    font-size: 25rpx;
	    font-weight: bold;
	    color: #333333;
	    line-height: 53rpx;
	    flex: 1;
	    text-align: center;
	    border-bottom: 1px solid #e5e5e5;
	    border-radius: 0px 0px 0px 0px;
	    padding: 13rpx;
	}
	.back{
		.name-content{
			width: 100rpx;
		}
	}
</style>
